package com.jt.controller;

import com.jt.entity.User;
import com.jt.interceptor.PageInterceptor;
import com.jt.service.UserService;
import com.jt.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/hello")
    public String hello(){
        //这个要分页  给page赋值
        Page page = new Page();
        ThreadLocal<Page> objectThreadLocal = new ThreadLocal<>();
        objectThreadLocal.set(page);
        PageInterceptor.setPage(objectThreadLocal);

        System.out.println(userService);
        userService.queryAll();
        return "OK";
    }

}
